package com.app.base.config.mq;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.FanoutExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * rabbitMQ login 配置
 * @author run
 * @date 2022/05/04
 */
@Configuration
public class RabbitConfig {

    public static final String DIRECT_EXCHANGE = "human_exchange";
    public static final String DIRECT_QUEUE = "human_queue";

    @Bean
    public FanoutExchange Exchange(){
        return new FanoutExchange(DIRECT_EXCHANGE,true,false);
    }

    @Bean
    public Queue Queue(){
        return new Queue(DIRECT_QUEUE,true);
    }

    @Bean
    public Binding Bing(){
        return BindingBuilder.bind(Queue()).to(Exchange());
    }
}
